package com.cskaoyan.javase.oop2._1extends._9hidden;
/**
 * 对象名点访问成员变量只需要看引用的类型就可以了
 * 完全不需要关心对象是什么.
 *
 * @since 16:16
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo2 {
    public static void main(String[] args) {
        Student s = new Student(18);
        System.out.println(s.age);
        Person p = new Student(18);
        System.out.println(p.age);
        Student s2 = new Student(8, 28);
        System.out.println(s2.age);
        Person p2 = new Student(8, 28);
        System.out.println(p2.age);

        new Student(8, 28);
    }
}
class Person{
    int age;

    public Person(int age) {
        this.age = age;
    }

    public Person() {
    }
}
class Student extends Person{
    int age;


    public Student(int age) {
        // super();
        this.age = age;
    }

    public Student(int age, int age1) {
        super(age);
        this.age = age1;
    }
}